<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>我的银行卡-添加银行卡</title>
<link rel="stylesheet" href="__PUBLIC__/Mobile/css/zhanghou.css">
<script src="__PUBLIC__/Mobile/js/jquery-1.9.1.js"></script>
<script src="__PUBLIC__/Common/Layer/layer.js"></script>
</head>

<body >
<div class="lm"> 
	<a href="javascript:history.back(-1);">
		<img src="__PUBLIC__/Mobile/images/return.png" style="height:22px; padding-left:2%; line-height:22px; width:6%; padding-top:2%;" class="left">
	</a>
    <span class="left size20">绑定银行卡 </span>
</div>
<!--我的银行卡-添加银行卡-->

<section>
<!--新建收货地址-->
<form action="{:U('Mycenter/bankcard_add')}" method="post">
<div class="Write">
	<p style="border:0"><b>开户姓名</b>
    <input type="text" name="realname">	</p>
	<p><b>身份证号</b>
    <input type="text" name="id_card"></p>
	<p><b>卡类型</b>
    <input type="text" name="type"></p>
	<p><b>所属银行</b>
    <input type="text" name="belong"></p>
	<p><b>银行卡号</b>
	  <input type="text" name="card_num">
	</p>
	<p><b>预留手机</b>
    <input type="text" name="mobile"></p>
</div>
<a href="javascript:;" id="a" class="immediately2 size26" style="background-color:#dd2222;">
绑定银行卡</a>
<!-- <input type="submit"> -->
</form>
</section>
<script>
$(function(){
	$('#a').click(function(){
		var realname = $('input[name=realname]').val();
		var id_card = $('input[name=id_card]').val();
		var type = $('input[name=type]').val();
		var belong = $('input[name=belong]').val();
		var card_num = $('input[name=card_num]').val();
		var mobile = $('input[name=mobile]').val();
		if(realname == ''){
			layer.tips('请输入姓名', 'input[name=realname]',{tips:3});
        	return false;
		}
		if(id_card == ''){
			layer.tips('请输入身份证', 'input[name=id_card]',{tips:3});
        	return false;
		}
		if(type == ''){
			layer.tips('请输入卡类型', 'input[name=type]',{tips:3});
        	return false;
		}
		if(belong == ''){
			layer.tips('请输入所属银行', 'input[name=belong]',{tips:3});
        	return false;
		}
		if(card_num == ''){
			layer.tips('请输入卡号', 'input[name=card_num]',{tips:3});
        	return false;
		}
		if(mobile == ''){
			layer.tips('请输入手机号码', 'input[name=mobile]',{tips:3});
        	return false;
		}
		$.ajax({
			data:"realname="+realname+"&id_card="+id_card+"&type="+type+"&belong="+belong+"&card_num="+card_num+"&mobile="+mobile,
			type:"POST",
			url:"{:U('Mycenter/bankcard_add')}",
			success:function(msg){
				console.log(msg);
				if(msg == 0){
					parent.layer.msg('绑定失败！',{icon:2,time:2000});
				}else if(msg == 1){
					parent.layer.msg('绑定成功！',{icon:1,time:1000},function(){
						window.location.reload();
					});
				}else{
					parent.layer.msg('银行卡已被绑定过！',{icon:2,time:2000});
				}
			}
		});
	});
})
</script>
</body>
</html>
